package cn.gmcx.lazy.izze.mapper;

import cn.gmcx.lazy.izze.pojo.Video;
import cn.gmcx.lazy.izze.pojo.VideoVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 视频 Mapper 接口
 * </p>
 *
 * @author GMCX
 * @since 2024-06-14
 */
@Mapper
public interface VideoMapper extends BaseMapper<Video> {

    int add(String videoUrl, Integer userId, Integer type, String synopsis);


    @Select("select * from video")
    List<VideoVo> selectAll();

    @Update("update video set  praise= praise +1 where id= #{id}")
    void updatePraise(Integer id);
    @Update("update video set  praise=praise-1 where id= #{id}")
    void cancelPraise(Integer id);
    @Update("update video set  concern=concern+1 where id= #{id}")
    void updateConcern(Integer id);



    @Update("update video set  comments=#{count} where id= #{videoId}")
    void updateComments(Integer videoId, Long count);

    @Update("update video set  share=share+1 where id= #{id}")
    void updateShare(Integer id);

    List<VideoVo> selectRandom();

}
